<template>
  <tr>
    <td><input type="checkbox" /></td>
    <td>{{ item.name }}</td>
    <td>{{ item.price }}</td>
    <td>
      <button @click="add(-1)">-</button>
      <span>{{ item.num }}</span>
      <button @click="add(1)">+</button>
    </td>
    <td>{{ item.price * item.num }}</td>
    <td>
      <button @click="del(index)">删除</button>
    </td>
  </tr>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
  name: 'CartFooter',
  props: {
    item: Object,
    index: Number
  },
  methods: {
    ...mapMutations(['add'])
  }
}
</script>
